package model;

public class AddTerm extends ElementarTerm {

	public AddTerm(String varName, String replacedPart) {
		super(varName, replacedPart);
	}

	@Override
	public void execute(VarValueList varValueList) {
		Value result = Value.add(varValueList.getValue(var1),varValueList.getValue(var2));
		varValueList.setValue(eleTermId, result);
	}

	@Override
	public String toString() {
		return "Add-Term:"+eleTermId+"="+var1+"+"+var2;
	}

	@Override
	public void speedExecute(SpeedVarValueList speedVarValueList) {
		speedVarValueList.setValue(eleTermId, speedVarValueList.internalMap
				.get(var1)
				+ speedVarValueList.internalMap.get(var2));
	}
	
}
